package ticketmachine.logic.priceStrategies;

public class PriceCalculatorFactory {
	
	private static PriceCalculatorFactory factory;

	public static PriceCalculatorFactory getInstance(){
		if (factory==null){
			factory=new PriceCalculatorFactory();
		}
		return factory;
	}

	public IPriceCalculatorStrategy getPriceCalculatorStrategy(String name){
		IPriceCalculatorStrategy pcs=null;
		try {
			pcs=(IPriceCalculatorStrategy) Class.forName(name).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return pcs;
	}

}
